-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Small cleanups #1285
base: master
Are you sure you want to change the base?
Small cleanups #1285
Conversation
Deployed to Cloudflare Pages
|
6e46b66
to
2a22b11
Compare
@@ -40,7 +41,7 @@ export const SnapshotCardExternalLink: FC<SnapshotCardExternalLinkProps> = ({ | |||
> | |||
{description} | |||
</Typography> | |||
{url && hasValidProtocol(url) && ( | |||
{url && (hasValidProtocol(url) || url.startsWith('mailto:')) && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a good solution
(unimportant note: you are not using emailAccepted)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(unimportant note: you are not using emailAccepted)
This part has been fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a good solution
What would you consider a good solution, instead of prop for the general purpose component?
Maybe a separate component used for displaying safe links?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code should make it obvious if it is safe. Right now you have to trace through the code to check if emailAccepted
is only used with safe sources of URLs.
Better options:
- all our components should have a safe interface
- sanitize/block malicious mail links in our components that allow urls
- whitelist externalLinks and block all other mail links
- block all mail links in our components. Pass pontusx mail link directly to the unsafe Button component (
<Button href=externalLinks...
makes it clear that it comes from a safe source) - block mail links and display pontusx email address instead
- all sources of links should be made safe. Sanitize malicious links in api.ts
Remove "mailto:" from the list of valid protocols, because it can be unsafe to click on mailto links. Supporting mailto: links can enable malicious URLs like javascript: and mailto:?attach=. We are trying to prevent that. Instead, provide a special "emailAccepted" when we know that the link is coming from a safe source, like our code.
bb88cc9
to
efc81f5
Compare
Amount: fromBaseUnits(event.body.Amount, paraTimesConfig[runtime].decimals), | ||
Denomination: getTokensForScope({ network, layer: runtime })[0].ticker, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is more wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix in #1539
Follow-ups from previous PRs.
For context, see: